<?
 @session_start();
 require_once("core.php");

 get_all_variables();
 $db = dbconnect();

 $q = "SELECT *
       FROM `messages`
       WHERE dest = ".$client."
       ORDER BY `id` DESC";
 $rmsgs = mysql_query($q, $db) or die(mysql_error());
 $nmsgs = mysql_num_rows($rmsgs);
 
 $q = "SELECT *
       FROM `messages`
       WHERE dest = -1
       ORDER BY `id` DESC";
 $ranns = mysql_query($q, $db);
 $nanns = mysql_num_rows($ranns);


?>
			   <p class="p_title">Announcements</p>
			   <p class="p_text">
			     <ul class="top5">
                    <? for ($i=0; $i<$nanns; $i++) {
                        $anns = mysql_fetch_array($ranns);
                        ?>
				     <li><a href="msg.php?id=<? echo $anns["id"]; ?>" rel="facebox"><span><? echo substr($anns["text"],0,35); ?></span></a></li>
                     <? }; ?> </ul>
				 <br />
			   </p>

			   <p class="p_title">Messages</p>
			   <p class="p_text">
			   	  <ul class="top5">
                    <? for ($i=0; $i<$nmsgs; $i++) {
                        $msgs = mysql_fetch_array($rmsgs);
                        ?>
				     <li><a href="msg.php?id=<? echo $msgs["id"]; ?>" rel="facebox"><span><? echo substr($msgs["text"],0,35); ?></span></a></li>
                     <? }; ?>
                  </ul>
				 <br />
			   </p>       